package com.lantosec.hmrp.modules.system.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.lantosec.hmrp.core.mvc.BaseEntity;
import com.lantosec.hmrp.modules.system.vo.SysAreaVO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * <p>
 * 区域表 实体类
 * </p>
 *
 * @author AutoCode
 * @since 2020-02-24
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SysArea extends BaseEntity<SysAreaVO> {

    private static final long serialVersionUID = 1L;
    public SysArea(SysAreaVO vo){
        this.areaId = vo.getAreaId();
        this.areaName = vo.getAreaName();
        this.parentId = vo.getParentId();
        this.leaf = vo.getLeaf();
        this.remark = vo.getRemark();
        this.areaOrder = vo.getAreaOrder();
    }

    @Override
    public SysAreaVO convertToVO(){
        return new SysAreaVO(this);
    }


    /**
     * 区域ID
     */
    @TableId(value = "area_id", type = IdType.ASSIGN_UUID)
    private String areaId;

    /**
     * 区域名称
     */
    private String areaName;

    /**
     * 上级ID
     */
    private String parentId;

    /**
     * 是否末级(0否1是)
     */
    private Boolean leaf;

    /**
     * 备注
     */
    private String remark;

    /**
     * 排序
     */
    private Integer areaOrder;


    public enum ColName {
        area_id, area_name, parent_id, leaf, remark, area_order,
    }
}
